package mvc.listener;

import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import mvc.bean.MvcBean;
import mvc.utils.MvcUtils;

public class ActionListener implements ServletContextListener{

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		ServletContext context=arg0.getServletContext();
		String xmlpath = context.getInitParameter("mvc");
		String tomcatpath = context.getRealPath("\\");
		try {
			Map<String, MvcBean> map = MvcUtils.mvcUtils(tomcatpath
					+ xmlpath);
			context.setAttribute("mvc", map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("信息系統已经加载完成");
	}

}
